package com.gggd.aopdemo.controller;

import com.gggd.aopdemo.anno.MyAnnotation;
import com.gggd.aopdemo.util.WebApiResult;
import com.gggd.aopdemo.vo.User;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author srx
 * @date 2021/12/24 17:32
 */
@RestController
@RequestMapping(value = "/demo")
public class DemoController {

    @GetMapping(value = "/getTest")
    public WebApiResult aopTest() {
        return WebApiResult.ok("成功");
    }

    @PostMapping(value = "/postTest")
    public WebApiResult aopTest2(@RequestParam("id") String id) {
        return WebApiResult.ok("成功");
    }

    @PostMapping("test02")
    @MyAnnotation
    public WebApiResult demo2(@RequestBody User user){
        return WebApiResult.ok("成功");
    }

    @PostMapping("test03")
    @MyAnnotation
    public WebApiResult demo3(@RequestBody User user){
        return WebApiResult.ok("成功", user);
    }

    @PostMapping("test04")
    @MyAnnotation
    public WebApiResult demo4(@RequestBody User user){
        String s = null;
        s.length();
        return WebApiResult.ok("成功", user);
    }

}
